#include <stdio.h>
#include <string.h>

int main()
{
    FILE* fp = fopen("log.txt","w");
    if(fp == NULL)
    {
        perror("fopen");
        return 1;
    }

    const char* msg = "HELLO";

    int cnt = 100;
    char buffer[128];
    while(cnt--)
    {
        memset(buffer,0,sizeof(buffer));
        snprintf(buffer,sizeof(buffer),"%d:%s\n",100-cnt,msg);
        fwrite(buffer,strlen(buffer),1,fp);
    }

    return 0;
}
